package com.slz3.business.module.memberManagement.memRecord.steward;

import com.slz3.business.frame.response.RR;
import com.slz3.business.frame.response.ResInfo;
import com.slz3.business.module.memberManagement.memRecord.domain.MemRecord;
import com.slz3.business.module.memberManagement.memRecord.domain.MemRecordCondition;
import org.springframework.web.reactive.function.server.ServerRequest;
import org.springframework.web.reactive.function.server.ServerResponse;
import reactor.core.publisher.Mono;

public class MemRecordResController {

    static Mono<ServerResponse> add(ServerRequest req, MemRecord memRecord) {
        if (MemRecordResUnsafeValid.add(req, memRecord)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return MemRecordResAtomic.add_$MemRecordUpdateLock(req, memRecord);
        }
    }

    static final Mono<ServerResponse> delete(ServerRequest req, MemRecordCondition memRecordCondition) {
        if (MemRecordResUnsafeValid.delete(req, memRecordCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return MemRecordResAtomic.delete_$MemRecordUpdateLock(req, memRecordCondition);
        }
    }

    static Mono<ServerResponse> modify(ServerRequest req, MemRecord memRecord) {
        if (MemRecordResUnsafeValid.modify(req, memRecord)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return MemRecordResAtomic.modify_$MemRecordUpdateLock(req, memRecord);
        }
    }

    static Mono<ServerResponse> list(ServerRequest req) {
        if (MemRecordResUnsafeValid.list(req)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return MemRecordResExecutor.list(req);
        }
    }

    static Mono<ServerResponse> info(ServerRequest req) {
        if (MemRecordResUnsafeValid.info(req)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return MemRecordResAtomic.info_$MemRecordUpdateLock(req);
        }
    }

    static Mono<ServerResponse> choice(ServerRequest req) {
        if (MemRecordResUnsafeValid.choice(req)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return MemRecordResExecutor.choice(req);
        }
    }

    static final Mono<ServerResponse> auditSubmit(ServerRequest req, MemRecordCondition memRecordCondition) {
        //
        if (MemRecordResUnsafeValid.auditSubmit(req, memRecordCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return MemRecordResAtomic.auditSubmit_$MemRecordUpdateLock(req, memRecordCondition);
        }
    }

    static final Mono<ServerResponse> audit(ServerRequest req, MemRecordCondition memRecordCondition) {
        if (MemRecordResUnsafeValid.audit(req, memRecordCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return MemRecordResAtomic.audit_$MemRecordUpdateLock(req, memRecordCondition);
        }
    }

    static final Mono<ServerResponse> auditReject(ServerRequest req, MemRecordCondition memRecordCondition) {
        if (MemRecordResUnsafeValid.auditReject(req, memRecordCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return MemRecordResAtomic.auditReject_$MemRecordUpdateLock(req, memRecordCondition);
        }
    }

    static final Mono<ServerResponse> usingEnable(ServerRequest req, MemRecordCondition memRecordCondition) {
        if (MemRecordResUnsafeValid.usingEnable(req, memRecordCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return MemRecordResAtomic.usingEnable_$MemRecordUpdateLock(req, memRecordCondition);
        }
    }

    static final Mono<ServerResponse> usingDisable(ServerRequest req, MemRecordCondition memRecordCondition) {
        if (MemRecordResUnsafeValid.usingDisable(req, memRecordCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return MemRecordResAtomic.usingDisable_$MemRecordUpdateLock(req, memRecordCondition);
        }
    }

}
